/**
 * 
 */
app.controller('cCoreApp', ['$scope', '$http', 'sLogin', '$timeout', '$rootScope', function($scope, $http, sLogin, $timeout,$rootScope) {

	$scope.activeItemProcessId = 0;
	$scope.showProcess = false;
	$scope.setActiveItemProcessId = function(id) {
		$scope.activeItemProcessId = id;
	}

	$scope.selectMenuItem = function(processId) {
		$scope.setActiveItemProcessId(processId);
    };
    $scope.getActiveProcessURL = function() {
    	if($scope.activeItemProcessId != 0) {
        	i = 0;
        	while ($scope.processes[i]) {
        	    if($scope.processes[i].id == $scope.activeItemProcessId) {
        	    	return $scope.processes[i].url;
        	    }
        	    i++;
        	}
    	}
    }
    
	$scope.$on('sLogin', function(event) {
		if(sLogin.processList) {
			$scope.processes = sLogin.processList;
		}
	});
}]);